/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.ac.cam.ccn.sac.modules.audio.message;

import java.io.IOException;
import org.ccnx.ccn.CCNHandle;
import org.ccnx.ccn.impl.CCNFlowControl;
import org.ccnx.ccn.impl.CCNFlowControl.SaveType;
import org.ccnx.ccn.io.ErrorStateException;
import org.ccnx.ccn.io.content.CCNSerializableObject;
import org.ccnx.ccn.io.content.ContentDecodingException;
import org.ccnx.ccn.io.content.ContentGoneException;
import org.ccnx.ccn.io.content.ContentNotReadyException;
import org.ccnx.ccn.protocol.ContentName;
import org.ccnx.ccn.protocol.ContentObject;
import org.ccnx.ccn.protocol.KeyLocator;
import org.ccnx.ccn.protocol.PublisherPublicKeyDigest;
import uk.ac.cam.ccn.sac.modules.audio.message.AudioMessage;

/**
 *
 * @author Thomas
 */
public class CCNSerializableAudioMessageObject extends CCNSerializableObject<AudioMessage> {
    public CCNSerializableAudioMessageObject(ContentName name, AudioMessage data, SaveType saveType, CCNHandle handle) 
	throws IOException {
		super(AudioMessage.class, false, name, data, saveType, handle);
	}

	public CCNSerializableAudioMessageObject(ContentName name, AudioMessage data, SaveType saveType, PublisherPublicKeyDigest publisher, 
			KeyLocator locator, CCNHandle handle) throws IOException {
		super(AudioMessage.class, false, name, data, saveType, publisher, locator, handle);
	}

	public CCNSerializableAudioMessageObject(ContentName name, CCNHandle handle) 
	throws ContentDecodingException, IOException {
		super(AudioMessage.class, false, name, (PublisherPublicKeyDigest)null, handle);
	}

	public CCNSerializableAudioMessageObject(ContentName name, PublisherPublicKeyDigest publisher,
			CCNHandle handle) 
	throws ContentDecodingException, IOException {
		super(AudioMessage.class, false, name, publisher, handle);
	}

	public CCNSerializableAudioMessageObject(ContentObject firstBlock, CCNHandle handle) 
	throws ContentDecodingException, IOException {
		super(AudioMessage.class, false, firstBlock, handle);
	}
        
        /**
	 * Internal constructor used by low-level network operations. Don't use unless you know what 
	 * you are doing.
	 * @param name name under which to save data
	 * @param data data to save when save() is called; or null if the next call will be updateInBackground()
	 * @param publisher key (identity) to use to sign the content (null for default)
	 * @param locator key locator to use to tell people where to find our key, should match publisher, (null for default for key)
	 * @param flowControl flow controller to use for network output
	 * @throws IOException
	 */
        public CCNSerializableAudioMessageObject(ContentName name, AudioMessage data, 
			PublisherPublicKeyDigest publisher, 
			KeyLocator locator,
			CCNFlowControl flowControl) throws IOException {
		super(AudioMessage.class, false, name, data, publisher, locator, flowControl);
	}
        
        /**
	 * Internal constructor used by low-level network operations. Don't use unless you know what 
	 * you are doing.
	 * @param name name under which to save data
	 * @param data data to save when save() is called; or null if the next call will be updateInBackground()
	 * @param publisher key (identity) to use to sign the content (null for default)
	 * @param locator key locator to use to tell people where to find our key, should match publisher, (null for default for key)
	 * @param flowControl flow controller to use for network output
	 * @throws IOException
	 */
	public CCNSerializableAudioMessageObject(ContentName name, PublisherPublicKeyDigest publisher,
			CCNFlowControl flowControl) throws ContentDecodingException, IOException {
		super(AudioMessage.class, false, name, publisher, flowControl);
	}
        
        /**
	 * Internal constructor used by low-level network operations. Don't use unless you know what 
	 * you are doing.
	 * @param name name under which to save data
	 * @param data data to save when save() is called; or null if the next call will be updateInBackground()
	 * @param publisher key (identity) to use to sign the content (null for default)
	 * @param locator key locator to use to tell people where to find our key, should match publisher, (null for default for key)
	 * @param flowControl flow controller to use for network output
	 * @throws IOException
	 */
	public CCNSerializableAudioMessageObject(ContentObject firstSegment, CCNFlowControl flowControl) 
	throws ContentDecodingException, IOException {
		super(AudioMessage.class, false, firstSegment, flowControl);
	}
        
        public AudioMessage audioMessage() throws ContentNotReadyException, ContentGoneException, ErrorStateException { return data(); }
}
